home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16806 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  44 lines

  1. Newsgroups: comp.lang.c++
  2. Path: newsfeed.internetmci.com!miwok!linex1!news
  3. From: mfried@linex.com (Marty Fried)
  4. Subject: Re: Button Problem???
  5. X-Nntp-Posting-Host: sp91.linex.com
  6. Message-ID: <316dcbb6.5095149@news.linex.com>
  7. Sender: news@linex1.linex.com
  8. Organization: Cirrius Cybernetics Corp
  9. X-Newsreader: Forte Agent .99e/32.201
  10. References: <4k5v31$7rs@newsbf02.news.aol.com>
  11. Date: Fri, 12 Apr 1996 03:27:59 GMT
  12.  
  13. Once upon a time (OK, it was 6 Apr 1996 09:28:49 -0500), sguit@aol.com
  14. (SGUIT) wrote:
  15.  
  16. >I have a Visual C++ 1.52 MFC project that uses buttons in a CFormView. How
  17. >can I make a button toggle on/off every time it's pressed. I need it to
  18. >stay down when pressed the first time then up when pressed again. Also, I
  19. >will need to only execute the code within the OnButton( ); only when it's
  20. >in its pressed down visual mode.....
  21. >Thanks.........man, I've looked every where for an example without any
  22. >luck.
  23.  
  24. I don't know of any examples.  Win95 has a new button-style checkbox,
  25. that I believe can even be a bitmap.  It acts like a checkbox, but
  26. looks like a button.
  27.  
  28. I've done something similar with CBitmapButton, where I created a
  29. padlock symbol that can be locked or unlocked.  I had to do something
  30. sneaky to get it to stay down - I swapped the bitmaps for up and down
  31. whenever it was clicked.  I somehow got rid of the button outline, so
  32. that only my bitmap was showing.  I forget what I did, but I could
  33. check if it sounds interesting.
  34.  
  35. Otherwise, creating a bitmap with the up and down bitmaps, and
  36. bitBlt'ing them on clicks will work.  I'd do a CWnd-based class that
  37. uses a static rect in AppStudio for size and position (destroying it
  38. after getting the info).
  39.  
  40. _______________________________________________________
  41. Marty Fried - mfried@linex.com     Press Enter to Exit
  42. San Anselmo, CA                           -NT message
  43. (MSVC4 + MFC) && (Win95 || NT);             
  44.